#pragma once

#define		MODEL_TREE_ROOT_NODE	0
#define		MODEL_TREE_MODEL_NODE	1
#define		MODEL_TREE_SUBE_NODE	2
#define		MODEL_TREE_ITEM_NODE	4
#define		MODEL_TREE_OPER_NODE	3

// CCheckModelTreeCtrl

class CCheckModelTreeCtrl : public CTreeCtrl
{
	DECLARE_DYNAMIC(CCheckModelTreeCtrl)

public:
	CCheckModelTreeCtrl();
	virtual ~CCheckModelTreeCtrl();

protected:
	CImageList		m_il;
	ck::CheckModel*	m_pModel;

	BOOL			m_isEditable;

public:	
	void	SetModel(ck::CheckModel* pModel);

	void	AttachBitmap();

	void	Populate(BOOL bIsShowAll);
	//void	PopulateAll();
	int		GetNodeType(HTREEITEM hItem);



protected:
	BOOL	PopulateSubElement(z_uint32 nParentCode, HTREEITEM hParentItem, BOOL bIsShowAll);
	BOOL	PopulateItem(z_uint32 nParentCode, HTREEITEM hParentItem, BOOL bIsShowAll);

	//void	PopulateAllSubElement(z_uint32 nParentCode, HTREEITEM hParentItem);
	//void	PopulateAllItem(z_uint32 nParentCode, HTREEITEM hParentItem);

	void	OnLabelClicked(HTREEITEM hItem);
	void	OnCheckBoxClicked(HTREEITEM hItem);
	
	
protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	afx_msg void OnNMRClick(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnRmenuModelTreeEditable();
	afx_msg void OnUpdateRmenuModelTreeEditable(CCmdUI *pCmdUI);
	afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
};


